Modular Rails by Denizet Thibault

Modular Rails by Denizet Thibault

Author:Denizet, Thibault
Language: eng
Format: epub
Publisher: Thibault Denizet
Published: 2015-04-20T16:00:00+00:00


Step 5: .rspec

I like to add the following to the .rspec file to get a better output when running the specs.

--color --require spec_helper --format documentation

Step 6: Run Tests

We can finally try to run the tests! From the Core engine folder, run rspec and you should get: Figure 4.14

Figure 4.14

Great, it’s working! Let’s add some factories and some simple tests now!

Step 7: Create User factory

Create the folders core/spec/factories/samurai/ and create a file named user.rb inside.

# core/spec/factories/samurai/user.rb require 'faker' module Samurai FactoryGirl.define do factory :user, class: 'Samurai/User' do |f| f.email { Faker::Internet.email } password 'password' password_confirmation 'password' admin false end factory :admin, parent: :user do |f| admin true end end end



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.